/**
 * 开票申请单打印
 * @author liuw
 * @date 2019-09-11
 */
define(['lodop'],function () {
    var self,
        app = win.app,
        doc = document,
        vueData = {
            GWED:null,
            GWED_LIST:null
        },
        pageVue
    ;
    app.newModule({
        init: function () {
            self = this;
            self._super({
                _tag: 'gwei006_print',
            }, win);
        },

        print:function(gweddocno){
            app.ajax({
                xurl:'crm/gwei006/print',
                xdata:{
                    GWEDDOCNO:gweddocno
                },
                type:'POST',
                dataType:'json',
                cb:function (result) {
                    if(result.ok) {
                        vueData.GWED=result.data.data.gwed;
                        vueData.GWED_LIST=result.data.data.gwed_list;
                    }
                }
            })
        },

        _call: function () {

        },

        _ready: function () {
            pageVue = new Vue({
                el: '#gwei006_print',
                data: vueData,
                methods: {
                },
                created: function () {
                    self._setEleIsReady('gwei006_print');
                },
                updated: function() {
                    var content=doc.getElementById('print_content').innerHTML;
                    var LODOP = getLodop();
                    LODOP.PRINT_INIT('打印');
                    LODOP.ADD_PRINT_HTM(30, 20, "95%", "98%", content);
                    //LODOP.ADD_PRINT_BARCODE(10, 80, 100, 115, "QRCode", rows[0]);
                    //LODOP.SET_PRINT_PAGESIZE(1,800,600,"");
                    LODOP.SET_PRINT_STYLEA(0, "HOrient", 3);
                    LODOP.SET_PRINT_STYLEA(0, "VOrient", 3);
                    LODOP.PREVIEW();
                }
            });
        },
        _lazy: function () {
            this._super();

        }
    });

});
